// const { default: axios } = require("axios");

getList('')
async function getList(data) {
    const res = await playList(data)
    $('.p-content')[0].innerHTML = ''
    res.data.playlists.forEach(element => {
        $('.p-content')[0].innerHTML += `<li>
        <div class="p-img">
            <img src="${element.coverImgUrl}" alt="">
            <a href="javascript:;"></a>
            <div class="p-bottom">
                <a class="fr" href="javascript:;"></a>
                <span></span>
                <span>${parseInt(element.playCount / 10000)}万</span>
            </div>
        </div>
        <p class="p-dec">
            <a class="f-thide" href="javascript:;">${element.name}</a>
        </p>
        <p class="p-author">
            <span>by</span>
            <a href="javascript:;">${element.creator.nickname}</a>
        </p>
    </li>`
    });
    $('.cateListBox').addClass('hide')
    $('.p-title span')[0].innerHTML = data == '' ? '全部' : data
}


async function playList(data) {
    // data = encodeURI(data)
    const res = await axios({
        url: `/top/playlist?cat=${data}&limit=35`,
        method: 'get'
    })
    return res;
}